package com.sysd.config;

import io.netty.util.concurrent.DefaultThreadFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.concurrent.*;

/**
 * @description:
 * @author: bsh
 * @date: 2025/6/6 09:16
 */
@Component
public class ThreadConfig {
    @Bean
    public ExecutorService executorService() {
        ThreadFactory threadFactory = new DefaultThreadFactory("netty-server");
        return new ThreadPoolExecutor(
                1, 1, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<>(2),threadFactory, new ThreadPoolExecutor.AbortPolicy()
        );
    }
}
